<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <input type="text" id="num">+
    <input type="text" id="num1">
    <button id="btn">=</button>
    <input type="text" id="num2">
    <script>
        document.getElementById("btn").onclick = function() {
            //获取第一个值并装换为数字
            var _num = Number(document.getElementById("num").value);
            //获取第二个值并装换为数字
            var _num1 = Number(document.getElementById("num1").value);
            var _num2 = _num1 + _num;
            //表单答案输入
            document.getElementById("num2").value = _num2;
        }
    </script>
</body>

</html>